<% layout('layout') -%>
<div class="page-header">
  <div class="page-title">
    <h2><%= tender ? '编辑招标信息' : '发布新的招标项目' %></h2>
    <span>完整填写药品需求细节，吸引符合条件的投标单位</span>
  </div>
  <a class="btn-secondary" href="/tenders">返回列表</a>
</div>

<div class="section-card">
  <form method="post" action="<%= tender ? ('/tenders/' + tender.id) : '/tenders' %>" class="form form-grid">
    <label>
      招标项目编号
      <input name="tender_code" value="<%= tender?.tender_code || '' %>" placeholder="如：YX-2025-001" required>
    </label>
    <label>
      药品名称
      <input name="drug_name" value="<%= tender?.drug_name || '' %>" placeholder="请输入药品名称" required>
    </label>
    <label>
      制药单位
      <input name="manufacturer" value="<%= tender?.manufacturer || '' %>" placeholder="生产厂家" required>
    </label>
    <label>
      包装要求
      <input name="package_req" value="<%= tender?.package_req || '' %>" placeholder="规格及包装说明">
    </label>
    <label>
      采购总量
      <input type="number" min="1" name="total_quantity" value="<%= tender?.total_quantity || '' %>" placeholder="数量" required>
    </label>
    <label>
      招标截止日期
      <input type="date" name="deadline" value="<%= (tender?.deadline || '').slice(0,10) %>" required>
    </label>
    <label>
      投标保证金（元）
      <input type="number" step="0.01" min="0" name="deposit_amount" value="<%= tender?.deposit_amount || '' %>" placeholder="请输入金额" required>
    </label>
    <div class="form-actions">
      <button type="submit"><%= tender ? '保存修改' : '发布招标' %></button>
      <a class="btn-outline" href="/tenders">取消返回</a>
    </div>
    <% if (error) { %>
      <div class="error"><%= error %></div>
    <% } %>
  </form>
</div>


